import 'package:flutter/material.dart';

import 'package:junyeyishu/utils/utils.dart';

class QGSaleDetailCell extends StatelessWidget {
  Map data;
  int? ttype;
  QGSaleDetailCell({super.key, required this.data,this.ttype});

  @override
  Widget build(BuildContext context) {
    bool locked = data["no_status"] == 2;

    return Container(
     
      margin: EdgeInsets.symmetric(horizontal: 15.rpx),
      padding: EdgeInsets.only(left: 15.rpx, right: 15.rpx, top: 20.rpx),
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Row(
                    children: [
                      Text(
                        data["name"] ?? data['order_name'],
                        style: TextStyle(
                            color: const Color(0xFFFFFFFF),
                            fontSize: 14.rpx,
                            fontWeight: FontWeight.bold),
                      ),
                      SizedBox(width: 4.rpx),
                      Container(
                        alignment: Alignment.center,
                        width: 35.rpx,
                        height: 18.rpx,
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(3.rpx),
                          border: Border.all(
                              color: locked
                                  ? const Color(0xFFFFFFFF)
                                  : const Color(0xFF4AE3FF)),
                        ),
                        child: 
                        ttype==0?
                        Text(
                          locked ? '锁定中' : "寄售",
                          style: TextStyle(
                              color: locked
                                  ? Color(0xFFFFFFFF)
                                  : Color(0xFF4AE3FF),
                              fontSize: 9.rpx,
                              fontWeight: FontWeight.normal),
                        ):Text(
                          "${data['goods_num']}件",
                          style: TextStyle(
                              color: locked
                                  ? Color(0xFFFFFFFF)
                                  : Color(0xFF4AE3FF),
                              fontSize: 9.rpx,
                              fontWeight: FontWeight.normal),
                        )
                      ),
                      // SizedBox(width: 6.rpx),
                      // data["isOwner"] == 1
                      //     ? Text(
                      //         "自己",
                      //         style: TextStyle(
                      //             color: Colors.red,
                      //             fontSize: 9.rpx,
                      //             fontWeight: FontWeight.normal),
                      //       )
                      //     : Container()
                    ],
                  ),
                  SizedBox(height: 14.rpx),
                  Row(
                    children: [
                  ttype==0?
                  Text(
                    '#${data["nft_no"]}/${data["total"]}',
                    style: TextStyle(
                        color:Color(0XFF989EA4),
                        fontSize: 12.rpx,
                        fontWeight: FontWeight.normal),
                  ):Text(
                    '#${data["random_nft_no"]}',
                    style: TextStyle(
                        color:Color(0XFF989EA4),
                        fontSize: 12.rpx,
                        fontWeight: FontWeight.normal),
                  ),

                  Container(
                    margin: EdgeInsets.only(left: 5.rpx),
                    width: 20.rpx,
                    height: 20.rpx,
                    alignment: Alignment.center,
                    decoration: BoxDecoration(
                      color: Color(0XFF44FFE2),
                      borderRadius: BorderRadius.circular(15.rpx)
                    ),
                    child: Text('汇',style: TextStyle(fontSize: 10,color: Color(0XFF141414))),
                  )

                    ],
                  )
                  
                ],
              ),
              Text(
                '￥${data["price"] ?? data["goods_price"]}',
                style: TextStyle(
                    color: const Color(0xFFFFFFFF),
                    fontSize: 16.rpx,
                    fontWeight: FontWeight.bold),
              ),
            ],
          ),
          SizedBox(height: 17.rpx),
          Container(height: 0.5.rpx, color: const Color(0xFF3D4854)),
        ],
      ),
    );
  }
}
